# -*- coding: utf-8 -*-
# @Time : 2022/1/25 14:06
# @Author : Limusen
# @File : allure_demo

import pytest
import os

current_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
report_json_path = os.path.join(current_path, '..', 'reports', 'json_html')
report_html_path = os.path.join(current_path, '..', 'reports', 'html')

# 设置json报告输出路径 --alluredir

if __name__ == '__main__':
    # --clean-alluredir 每次执行之前删除上一次的json文件
    pytest.main(['-s', '-v', '--alluredir=%s' % report_json_path, '--clean-alluredir','test_demo_06.py'])
    # 　执行命令，将json文件转换成html报告输出
    os.system('allure generate %s -o %s --clean' % (report_json_path, report_html_path))
